package com.etone.smartAudit.controller;


import com.etone.smartAudit.domain.CertificatePersonInfo;
import com.etone.smartAudit.dto.certificate.AddHandPersonDTO;
import com.etone.smartAudit.service.CertificatePersonInfoService;
import com.etone.smartAudit.vo.certificate.HandPersonVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 存证单执行人信息  前端控制器
 * </p>
 *
 * @author jiayen
 * @since 2021-06-08
 */
@Api(value = "执行信息", tags = "执行人信息")
@RestController
public class CertificatePersonInfoController {

    @Autowired
    private CertificatePersonInfoService personService;


    @PostMapping("/certificatePersonInfo/add")
    @ApiOperation(value = "添加执行人", tags = "jiayen")
    public CertificatePersonInfo addPerson(@RequestBody AddHandPersonDTO addHandPersonDTO) {
        return personService.addPerson(addHandPersonDTO);
    }

    @GetMapping("/certificatePersonInfo/list")
    @ApiOperation(value = "获取执行人列表", tags = "jiayen")
    public List<HandPersonVo> listPersons(@ApiParam("1-需求单，2-确认单") Integer type) {
//        CerAuthorization 判断是否校验成功
        return personService.listPersons(type);
    }
}
